package com.xu.mylol.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.xu.mylol.R;
import com.xu.mylol.adapter.MyOnClickListener;
import com.xu.mylol.adapter.MyRecyclerViewAdapter;
import com.xu.mylol.adapter.MyRecyclerViewAdapter_Gift;

/**
 * Created by dllo on 16/1/11.
 */
public class Fragment_Data_Gift extends Fragment implements MyOnClickListener {
    private RecyclerView recyclerView;
    private MyRecyclerViewAdapter_Gift adapter;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_data_gift,null);
        recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_review_gift);
        return view;
    }
    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        adapter = new MyRecyclerViewAdapter_Gift(this.getActivity());
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        adapter.setMyOnClickListener(this);
    }

    @Override
    public void onMyClick(int position) {
        Toast.makeText(Fragment_Data_Gift.this.getActivity(),
                "这是符文详情的第" + position + "条数据", Toast.LENGTH_SHORT).show();
    }
}
